Skip to main content

All Questions

Tagged with
0votes
1answer
51views

How to Load Personal .bash_rc for SU User via Direct SSH command

Problem Multiple engineers are using same machine with same loginuser and history gets loaded with others' people commands. Update: People login via private ssh keys (pub added/removed via trustedhosr)...
Vladimir Djuricic's user avatar
1vote
1answer
3kviews

Using sudo over ssh: sudo command not found

I am trying to run a command on a remote server as the superuser through ssh. For that, I pass the command with ssh -t from macOS as follows: bash-5.2$ ssh -t [email protected] "sudo echo Hi" ...
Shubham Johri's user avatar
-1votes
2answers
504views

How to use pipe with "sudo -ui"?

I have this command cat ~/.ssh/id_dsa.pub | ssh root@[my_server] "cat >> ~/.ssh/authorized_keys" How can I do the same thing but with sudo -iu user1 before the 2nd cat? That is, I ...
Johsua's user avatar
3votes
2answers
2kviews

Writing data into a file via SSH has permission error, even with sudo

I am creating an automation script. As part of it, I want to add a cron job. Here's a part of the script that fails: BACKUP_USER=backupbot SCRIPT_NAME=backup-script.sh scp -i ./ssh-key ./$SCRIPT_NAME ...
mnj's user avatar
  • 291
1vote
0answers
608views

echo hashed password for sudo command in multi system

I want to make a shell that sends command which runs at sudo level, from a system to multiple system. for example: for system in ${systems[@]}; do ssh $system "echo 'password' | sudo -S yum -...
Lunartist's user avatar
4votes
4answers
9kviews

Running a script file over ssh through sudo

I can log in to a remote machine as a user who can do sudo su -. I can't login as root. I have a script locally that I want to run at the remote machine. Also, the script is sent there trough another ...
Ondra Žižka's user avatar
0votes
1answer
514views

How to avoid quoting and escaping needed when passing commands and local variables to ssh with sudo?

How to avoid quoting and escaping needed when passing commands and local variables to ssh with sudo? Found someone providing a creative way to avoid quoting by using here-documents. It sounded like a ...
dabest1's user avatar
2votes
1answer
2kviews

Submit password with sudo and execute script with nohup

I would like to download and run a script in the background so the task is independent of the shell and its exit. Moreover this script should be run as sudo, using: echo MY_PWD | sudo -u MY_USER -S .....
user3191334's user avatar
1vote
2answers
2kviews

Sudo with password and append to file via SSH

What i'm trying to do is the following. SSH to remote host. Append the public_keys in the logged in users authorized_keys file to all the users .ssh/authorized_keys file. I've run into problem ...
JazzCat's user avatar
3votes
1answer
5kviews

Possible to pipe command using su via ssh

I'm trying to write a python script to remotely update the login passwords for a set of account I administer - I can already successfully use python to pipe remote commands via the stdin of an ssh ...
user48956's user avatar
2votes
1answer
17kviews

How to run multiple sudo commands over already opened ssh connection

I am trying to navigate from one server"USER1" to another using ssh as a user "USER2". ssh -t $hostname "sudo su - USER2; whoami; pwd" Post executing the above, I am able to successfully navigate to ...
dnup1092's user avatar
1vote
1answer
227views

Updating a bunch of Macs via SSH

allI'm working on a script that'll be running from our Mac server, and it will (hopefully) update all of our Macs via Munki (repo is on the same server) and the built-in softwareupdate command. Here'...
zomgdavidbowie's user avatar
4votes
1answer
28kviews

"sudo: sorry, you must have a tty to run sudo" when using sudo in a remote script

I want to run a series of sudo-elevated commands on a remote machine from an embedded script. To simplify the question, I'm just trying to run sudo id and get it to tell me that it's root. I am ...
Andy's user avatar
0votes
1answer
584views

Process substitution over ssh with sudo in Bash shell

What is the proper way to do something like this: diff <( ssh -t myuser@hosta 'sudo httpd -M') <(httpd -M) When I want to compare the output of the 2 commands, the first on a remote host the ...
Gregg Leventhal's user avatar
2votes
1answer
3kviews

ssh with sudo doesn't start services

I want to run command with sudo through ssh without disabling "requiretty" sudo option. According to /etc/sudoers: # # Disable "ssh hostname sudo <cmd>", because it will show the password in ...
Soid's user avatar
  • 121

153050per page
close